#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include "ConfProto.h"
#include "tblutil.h"
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\LCT.h>



static void *storeFromStruct;

static int recordNum;
void registerLCT(void *ptr)
{
	 storeFromStruct = ptr;
}

void *dealWithAddressBoundary(void*address);
int	inLoadLCTRecFromStruct (int inRecNumber, void *vdStruct)
{
	int inRet;
	char* tmp = (char*)vdStruct;

	registerLCT(vdStruct);
	vdStruct = dealWithAddressBoundary(vdStruct);
	inRet = inLoadConfRec(LCT_FILENAME, SIZE_LCT_REC, inRecNumber, vdStruct);

	recordNum = inRecNumber;
	return inRet;
}

void vdRestoreLCTRecFromStruct(void *vdStruct)
{
	registerLCT(vdStruct);
	vdStruct = dealWithAddressBoundary(vdStruct);
	memcpy((char *) pvdGetLCTRec(), vdStruct, SIZE_LCT_REC);

}

void vdCopyLCTRecFromStruct(void *vdStruct)
{
	registerLCT(vdStruct);
	vdStruct = dealWithAddressBoundary(vdStruct);
		memcpy(vdStruct, (char *) pvdGetLCTRec(), SIZE_LCT_REC);

}

int	inSaveLCTRecFromStruct (int inRecNumber,  void *vdStruct)
{
	int inRet;

	registerLCT(vdStruct);
	vdStruct = dealWithAddressBoundary(vdStruct);
	inRet = inSaveConfRec(LCT_FILENAME, SIZE_LCT_REC, inRecNumber, (char *) vdStruct);

	return inRet;
}

int	inUpdateLCTRecFromStruct (void *vdStruct)
{
	int inRet;

	registerLCT(vdStruct);
	vdStruct = dealWithAddressBoundary(vdStruct);
	inRet = inSaveConfRec(LCT_FILENAME, SIZE_LCT_REC, recordNum, (char *) vdStruct);

	return inRet;
}

char* szGetLanguageNamePrefixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetLanguageNamePrefix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szLanguageNamePrefix;
}

void vdSetLanguageNamePrefixFromStruct(const char* szLanguageNamePrefix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetLanguageNamePrefix(szLanguageNamePrefix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szLanguageNamePrefix, szLanguageNamePrefix, sizeof(((LCT_REC*)NULL)->szLanguageNamePrefix)-1);
}

char* szGetLanguageNameFontBytesFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetLanguageNameFontBytes();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szLanguageNameFontBytes;
}

void vdSetLanguageNameFontBytesFromStruct(const char* szLanguageNameFontBytes, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetLanguageNameFontBytes(szLanguageNameFontBytes);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szLanguageNameFontBytes, szLanguageNameFontBytes, sizeof(((LCT_REC*)NULL)->szLanguageNameFontBytes)-1);
}

char* szGetReport1NamePrefixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetReport1NamePrefix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szReport1NamePrefix;
}

void vdSetReport1NamePrefixFromStruct(const char* szReport1NamePrefix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetReport1NamePrefix(szReport1NamePrefix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szReport1NamePrefix, szReport1NamePrefix, sizeof(((LCT_REC*)NULL)->szReport1NamePrefix)-1);
}

char* szGetReport2NamePrefixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetReport2NamePrefix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szReport2NamePrefix;
}

void vdSetReport2NamePrefixFromStruct(const char* szReport2NamePrefix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetReport2NamePrefix(szReport2NamePrefix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szReport2NamePrefix, szReport2NamePrefix, sizeof(((LCT_REC*)NULL)->szReport2NamePrefix)-1);
}

char* szGetClerkReportNamePrefixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetClerkReportNamePrefix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szClerkReportNamePrefix;
}

void vdSetClerkReportNamePrefixFromStruct(const char* szClerkReportNamePrefix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetClerkReportNamePrefix(szClerkReportNamePrefix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szClerkReportNamePrefix, szClerkReportNamePrefix, sizeof(((LCT_REC*)NULL)->szClerkReportNamePrefix)-1);
}

char* szGetShiftReportNamePrefixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetShiftReportNamePrefix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szShiftReportNamePrefix;
}

void vdSetShiftReportNamePrefixFromStruct(const char* szShiftReportNamePrefix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetShiftReportNamePrefix(szShiftReportNamePrefix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szShiftReportNamePrefix, szShiftReportNamePrefix, sizeof(((LCT_REC*)NULL)->szShiftReportNamePrefix)-1);
}

char* szGetFleetReportNamePrefixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetFleetReportNamePrefix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szFleetReportNamePrefix;
}

void vdSetFleetReportNamePrefixFromStruct(const char* szFleetReportNamePrefix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetFleetReportNamePrefix(szFleetReportNamePrefix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szFleetReportNamePrefix, szFleetReportNamePrefix, sizeof(((LCT_REC*)NULL)->szFleetReportNamePrefix)-1);
}

char* szGetTemplateFileNameSuffixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetTemplateFileNameSuffix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szTemplateFileNameSuffix;
}

void vdSetTemplateFileNameSuffixFromStruct(const char* szTemplateFileNameSuffix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetTemplateFileNameSuffix(szTemplateFileNameSuffix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szTemplateFileNameSuffix, szTemplateFileNameSuffix, sizeof(((LCT_REC*)NULL)->szTemplateFileNameSuffix)-1);
}

short shGetFontTypeFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return shGetFontType();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->shFontType;
}

void vdSetFontTypeFromStruct(short shFontType, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetFontType(shFontType);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	((LCT_REC*)vdStruct)->shFontType = shFontType;
}

char* szGetActionFontNameFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetActionFontName();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szActionFontName;
}

void vdSetActionFontNameFromStruct(const char* szActionFontName, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetActionFontName(szActionFontName);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szActionFontName, szActionFontName, sizeof(((LCT_REC*)NULL)->szActionFontName)-1);
}

short shGetActionGridTypeFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return shGetActionGridType();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->shActionGridType;
}

void vdSetActionGridTypeFromStruct(short shActionGridType, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetActionGridType(shActionGridType);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	((LCT_REC*)vdStruct)->shActionGridType = shActionGridType;
}

char* szGetMenuFontNameFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetMenuFontName();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szMenuFontName;
}

void vdSetMenuFontNameFromStruct(const char* szMenuFontName, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetMenuFontName(szMenuFontName);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szMenuFontName, szMenuFontName, sizeof(((LCT_REC*)NULL)->szMenuFontName)-1);
}

short shGetMenuGridTypeFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return shGetMenuGridType();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->shMenuGridType;
}

void vdSetMenuGridTypeFromStruct(short shMenuGridType, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetMenuGridType(shMenuGridType);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	((LCT_REC*)vdStruct)->shMenuGridType = shMenuGridType;
}

short inGetCountryCodeFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return inGetCountryCode();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->inCountryCode;
}

void vdSetCountryCodeFromStruct(short inCountryCode, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetCountryCode(inCountryCode);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	((LCT_REC*)vdStruct)->inCountryCode = inCountryCode;
}

char* szGetMerchReportNamePrefixFromStruct(void*vdStruct)
{
	if(vdStruct != storeFromStruct)
		return szGetMerchReportNamePrefix();
	vdStruct = dealWithAddressBoundary(vdStruct);
	return ((LCT_REC*)vdStruct)->szMerchReportNamePrefix;
}

void vdSetMerchReportNamePrefixFromStruct(const char* szMerchReportNamePrefix, void*vdStruct)
{
	if(vdStruct != storeFromStruct)
	{
		vdSetMerchReportNamePrefix(szMerchReportNamePrefix);
		return;
	}
	vdStruct = dealWithAddressBoundary(vdStruct);
	strNumCopy(((LCT_REC*)vdStruct)->szMerchReportNamePrefix, szMerchReportNamePrefix, sizeof(((LCT_REC*)NULL)->szMerchReportNamePrefix)-1);
}

